home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Form1
- BackColor = &H00FFFFFF&
- BorderStyle = 1 'Fixed Single
- ClientHeight = 105
- ClientLeft = 4080
- ClientTop = 4650
- ClientWidth = 5385
- ClipControls = 0 'False
- Enabled = 0 'False
- Height = 510
- Left = 4020
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 105
- ScaleWidth = 5385
- Top = 4305
- Width = 5505
- Begin Label Label2
- Alignment = 2 'Center
- AutoSize = -1 'True
- BackColor = &H000000FF&
- BackStyle = 0 'Transparent
- Caption = "10%"
- Height = 195
- Left = 2040
- TabIndex = 1
- Top = 0
- Width = 375
- End
- Begin Label Label1
- Alignment = 2 'Center
- BackColor = &H000000FF&
- Height = 375
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 1695
- End
- DefInt A-Z
- Option Explicit
- Declare Function GetWindowWord% Lib "User" (ByVal hWnd%, ByVal nIndex%)
- Declare Function SetWindowWord% Lib "User" (ByVal hWnd%, ByVal nIndex%, ByVal wNewWord%)
- Declare Function GetWindowLong& Lib "User" (ByVal hWnd%, ByVal nIndex%)
- Declare Function SetWindowLong& Lib "User" (ByVal hWnd%, ByVal nIndex%, ByVal dwNewLong&)
- Const GWW_ID = (-12)
- Const GWL_STYLE = (-16)
- Const WS_DLGFRAME = &H400000
- Const WS_SYSMENU = &H80000
- Const WS_MINIMIZEBOX = &H20000
- Const WS_MAXIMIZEBOX = &H10000
- Sub Form_Load ()
- Dim r
- titlebar form1, False
- label1.Width = 0
- r = DoEvents()
- form_resize
- End Sub
- Sub form_resize ()
- form1.Height = 300
- label1.Height = form1.Height
- Label2.Left = form1.Width / 2.25
- Label2.Top = (label1.Height / 2) - (Label2.Height / 2)
- End Sub
- Sub titlebar (frm As Form, ShowTitle)
- Static Oldhmenu, SavedStyle&
- Dim NewStyle&, t&
- If ShowTitle Then
- 'get the current style attributes
- NewStyle& = GetWindowLong&(frm.hWnd, GWL_STYLE)
-
- 'set only the attributes that were removed earlier
- NewStyle& = NewStyle& Or SavedStyle&
-
- 're-establish the menu
- If Oldhmenu <> 0 Then
- t& = SetWindowWord%(frm.hWnd, GWW_ID, Oldhmenu)
- End If
-
- 'set the new style
- t& = SetWindowLong&(frm.hWnd, GWL_STYLE, NewStyle&)
-
- 'force VB to update the form
- frm.Left = frm.Left
- frm.Refresh
- Else
- 'get the current style attributes
- NewStyle& = GetWindowLong&(frm.hWnd, GWL_STYLE)
- 'determine whether the form has a dialog frame, a ControlBox,
- 'a minimize button, or a maximize button and save this info.
- 'for later use
- SavedStyle& = 0
- SavedStyle& = SavedStyle& Or (NewStyle& And WS_DLGFRAME)
- SavedStyle& = SavedStyle& Or (NewStyle& And WS_SYSMENU)
- SavedStyle& = SavedStyle& Or (NewStyle& And WS_MINIMIZEBOX)
- SavedStyle& = SavedStyle& Or (NewStyle& And WS_MAXIMIZEBOX)
- 'remove the attributes for a dialog frame, a ControlBox, a minimize
- 'button and a maximize button
- NewStyle& = NewStyle& And Not WS_DLGFRAME
- NewStyle& = NewStyle& And Not WS_SYSMENU
- NewStyle& = NewStyle& And Not WS_MINIMIZEBOX
- NewStyle& = NewStyle& And Not WS_MAXIMIZEBOX
- 'is there a menu associated with this form?
- Oldhmenu = GetWindowWord%(frm.hWnd, GWW_ID)
- If Oldhmenu <> 0 Then
- 'yes-zero it the menu handle
- t& = SetWindowWord%(frm.hWnd, GWW_ID, 0)
- End If
- 'set the new style
- t& = SetWindowLong&(frm.hWnd, GWL_STYLE, NewStyle&)
- 'force VB to update the form and get rid of the title bar
- frm.Left = frm.Left
- frm.Refresh
- End If
- End Sub
-